version: Avoid error message when entire output is not read
authorJoey Hess <joeyh@joeyh.name>
Fri, 19 May 2023 19:00:57 +0000 (15:00 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 19 May 2023 19:00:57 +0000 (15:00 -0400)
Sponsored-by: Dartmouth College's Datalad project
CHANGELOG
Command/Version.hs
doc/bugs/dropkey_-z_does_not_drop_etc/comment_6_d6377ddfb9d907d56c70141b0c3a8a32._comment [new file with mode: 0644]
doc/bugs/dropkey_-z_does_not_drop_etc/comment_7_57b63abb8ccb7fbbd71afd599cb9ef5c._comment [new file with mode: 0644]

index 21b6fb0acba084a507dba9cd22d9d6157ea631df..520e8d6eb0425763c65e99cb7ba9abcadff55c1c 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -66,6 +66,7 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
     annex.synccontent.
   * sync: Added -g as a short option for --no-content.
   * Fix bug in -z handling of trailing NUL in input.
+  * version: Avoid error message when entire output is not read.
 
  -- Joey Hess <id@joeyh.name>  Sat, 08 Apr 2023 13:57:18 -0400
 
index 71cfe141e76c7fe49d2c0de8fa0932f83d488bd1..9252652d1e7847e18d780ee33527e8784f7dff7a 100644 (file)
@@ -78,5 +78,6 @@ showRawVersion = do
        putStr BuildInfo.packageversion
        hFlush stdout -- no newline, so flush
 
+-- Ignore failure to write so that this command can eg be piped to head.
 vinfo :: String -> String -> IO ()
-vinfo k v = putStrLn $ k ++ ": " ++ v
+vinfo k v = void $ tryIO $ putStrLn $ k ++ ": " ++ v
diff --git a/doc/bugs/dropkey_-z_does_not_drop_etc/comment_6_d6377ddfb9d907d56c70141b0c3a8a32._comment b/doc/bugs/dropkey_-z_does_not_drop_etc/comment_6_d6377ddfb9d907d56c70141b0c3a8a32._comment
new file mode 100644 (file)
index 0000000..59bc49f
--- /dev/null
@@ -0,0 +1,11 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 6"""
+ date="2023-05-19T18:54:53Z"
+ content="""
+Aha, thanks for clearing up that `git-annex version` does that! That seems
+like a bit of a bug on its own really. 
+
+
+.. Fixed that.
+"""]]
diff --git a/doc/bugs/dropkey_-z_does_not_drop_etc/comment_7_57b63abb8ccb7fbbd71afd599cb9ef5c._comment b/doc/bugs/dropkey_-z_does_not_drop_etc/comment_7_57b63abb8ccb7fbbd71afd599cb9ef5c._comment
new file mode 100644 (file)
index 0000000..1c49707
--- /dev/null
@@ -0,0 +1,18 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 7"""
+ date="2023-05-19T18:55:35Z"
+ content="""
+The reason dropkeys does not error on an unknown key is that it's entirely
+possible to get a repository into a state where a key's content is present
+but the key is otherwise unknown to git-annex. Eg, it doesn't have any
+location tracking information for it, there are no files in the git repo
+that point to it, etc. 
+
+It makes sense to support dropping the content of such a key.
+
+And, dropkeys intentionally operates the same on a key when its content is
+not present as it does when the content is present and it successfully
+dropped it. Because in either case the result is now that the specified
+key's content is not present.
+"""]]